<template>
  <PromiseDialog ref="dialog">
    <Form @suc="onResolve" @error="onReject" :id="id" />
  </PromiseDialog>
</template>
<script lang="ts">
import Vue from 'vue'
import PromiseDialog from '@/components/PromiseDialog.vue'
import Form from './FormAddOrEdit.vue'
export default Vue.extend({
  name: 'DialogAddOrEditRole',
  components: {
    PromiseDialog,
    Form
  },
  props: ['id'],
  methods: {
    open () {
      return (this.$refs.dialog as PromiseDialog).open()
    },
    onResolve () {
      return (this.$refs.dialog as PromiseDialog).resolve()
    },
    onReject () {
      return (this.$refs.dialog as PromiseDialog).reject()
    }
  }
})
</script>
